//
//  MCCViewController.m
//  MindCloudConfigCellModule
//
//  Created by Allen on 10/20/2020.
//  Copyright (c) 2020 Allen. All rights reserved.
//

#import "MCCViewController.h"

#import <Masonry/Masonry.h>
#import "MCCCellUISetting.h"
#import "MCCXibCell.h"


@interface MCCViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *testConfigBaseTable;

@end

@implementation MCCViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.view addSubview:self.testConfigBaseTable];
    [self.testConfigBaseTable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
	
}

-(UITableView *)testConfigBaseTable{
    if (!_testConfigBaseTable) {
        _testConfigBaseTable = [UITableView new];
        _testConfigBaseTable.delegate = self;
        _testConfigBaseTable.dataSource = self;
        _testConfigBaseTable.separatorStyle = UITableViewCellEditingStyleNone;
        _testConfigBaseTable.showsVerticalScrollIndicator = NO;
        _testConfigBaseTable.backgroundColor = [UIColor clearColor];
        _testConfigBaseTable.estimatedRowHeight = UITableViewAutomaticDimension;
//        [_testConfigBaseTable registerClass:[ConfigureBaseCell class] forCellReuseIdentifier:@"ConfigureBaseCell"];
        
        [_testConfigBaseTable registerNib:[UINib nibWithNibName:@"MCCXibCell" bundle:[MCCToolClass MindCloudConfigCellBundle]] forCellReuseIdentifier:@"MCCXibCell"];
    }
    return _testConfigBaseTable;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 7;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(CellConfigSetting *)cellUISettingByIndexRow:(NSInteger)rowIndex{
    return @[[MCCCellUISetting emergencyEquipCellConfigureSetting],
             [MCCCellUISetting emergencyEquipDetailCellConfigureSetting],
    [MCCCellUISetting emergencyMaterialCellConfigureSetting],
    [MCCCellUISetting emergencyMaterialDetailCellConfigureSetting],
    [MCCCellUISetting storageInfoRow1],
    [MCCCellUISetting storageInfoRow2],
    [MCCCellUISetting storageInfoRow3]][rowIndex];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
//    ConfigureBaseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ConfigureBaseCell" forIndexPath:indexPath];
    
    MCCXibCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MCCXibCell" forIndexPath:indexPath];
    [cell setCellUIConfig:[self cellUISettingByIndexRow:indexPath.row]];
    return cell;
}


@end
